home *** CD-ROM | disk | FTP | other *** search
/ LOGIC Apps / Logic-APPLE_II_APPS.iso / mac / LOGIC Apple II 5.25" Library - ProDOS / PRO081.dsk / UNIDISK / UDSK.04.MAC.txt < prev    next >
Text File  |  2012-02-16  |  7KB  |  161 lines

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6.  
  7. UniDisk 3.5
  8. #4:    Accessing Macintosh Disks
  9.  
  10. Revised by:    Matt Deatherage                                  November 1988
  11. Written by:    Mike Askins                                           May 1985
  12.  
  13. This Technical Note formerly discussed drive-specific SmartPort calls.  These 
  14. calls are now documented in the Apple IIGS Firmware Reference.  This Note now 
  15. describes how to access Macintosh disks from a UniDisk 3.5 disk drive, as this 
  16. information was not documented in the manual.
  17. _____________________________________________________________________________
  18.  
  19.  
  20. Macintosh Disk Access
  21.  
  22. The disk data format used in the UniDisk 3.5 is essentially identical to that 
  23. used for Macintosh disks.  There are three notable differences between the two 
  24. formats:
  25.  
  26. o    Macintosh blocks are 524 bytes; UniDisk 3.5 blocks are 512 bytes.
  27. o    Macintosh MFS disks are single sided; UniDisk 3.5 disks are double 
  28.      sided.  (Macintosh HFS disks are double sided.)
  29. o    The Macintosh uses a 2:1 physical block interleave; the UniDisk 
  30.      3.5 uses a 4:1 interleave.
  31.  
  32.  
  33. Accessing Blocks on a Macintosh Disk
  34.  
  35. Reading from a Macintosh disk is accomplished with the use of the READ command 
  36. (as opposed to the READBLOCK command, which enforces 512 byte data.)  A call 
  37. to load block zero from the Macintosh disk in Unit #1 into memory at $2000 
  38. would look like this:
  39.  
  40. MacRead    JSR    Dispatch                ;Normal SmartPort Entry point
  41.            DFB    $08                     ;Character READ command code
  42.            DW     Cmd_List                ;The parameter list
  43.            BCS    Error                   ;Optional error handling...
  44.            ...
  45. Cmd_List   DFB    $04                     ;CharRead has four parameters
  46.            DFB    $01                     ;Unit number
  47.            DW     $2000                   ;Buffer address
  48.            DW     524                     ;Always transfer 524 bytes
  49.            DFB    $00                     ;Block (lo)
  50.            DFB    $00                     ;Block (med)
  51.            DFB    $00                     ;Block (hi) 
  52.  
  53.  
  54. Writing to a Macintosh disk is accomplished with the use of the WRITE command.  
  55. A call to write block zero to the Macintosh disk in Unit #1 with data at 
  56. memory location $2000 would look like this:
  57.  
  58. MacWrite   JSR    Dispatch                ;Normal SmartPort Entry point
  59.            DFB    $09                     ;Character WRITE command code
  60.            DW     Cmd_List                ;The parameter list
  61.            BCS    Error                   ;Optional error handling...
  62.         
  63. The Cmd_List is the same as in the READ example.
  64.  
  65.  
  66. Formatting Macintosh Disks
  67.  
  68. The formatting routine in the UniDisk 3.5 firmware can format single- or 
  69. double-sided disks of variable physical block interleave.  The parameters 
  70. controlling the interleave and the number of disk sides are located in the 
  71. controller's zero page and are set to defaults whenever the INIT call is 
  72. issued to SmartPort.  These parameters can be altered by using the 
  73. SET_DOWN_ADR and DOWNLOAD subcalls of the CONTROL call.  Once altered, the 
  74. FORMAT call uses these values in the formatting process.  These zero page 
  75. locations and their values are detailed below:
  76.  
  77. Parameter      Location                 Values
  78. Interleave     $0062           $02 = Mac,    $04 = UniDisk 3.5
  79. DoubleSided    $0063           $00 = Single, $80 = Double-sided
  80.  
  81. The following code example formats the media in Unit #1 as a Macintosh disk:
  82.  
  83. MacFormat  JSR    Dispatch                ;Set address to patch interleave
  84.            DFB    $04                     ;Control call (Set_Down_Adr)
  85.            DW     Cmd_ListA               ;Parameter List
  86.            BCS    Error
  87. ;
  88.            JSR    Dispatch                ;Now patch the interleave byte
  89.            DFB    $04                     ;Control call (DOWNLOAD)
  90.            DW     Cmd_ListB               ;Parameter List
  91.            BCS    Error
  92. ;
  93.            JSR    Dispatch                ;Set address to patch single sided
  94.            DFB    $04                     ;Control call (Set_Down_Adr)
  95.            DW     Cmd_ListC               ;Parameter List
  96.            BCS    Error
  97. ;
  98.            JSR    Dispatch                ;Now patch the single sided byte
  99.            DFB    $04                     ;Control call (DOWNLOAD)
  100.            DW     Cmd_ListD               ;Parameter List
  101.            BCS    Error
  102. ;
  103.            JSR    Dispatch                ;Finally...
  104.            DFB    $03                     ;This is the actual format call
  105.            DW     Cmd_ListE               ;Parameter List
  106.            BCS    Error
  107. ;
  108.            RTS
  109.  
  110. The parameter lists are as follows:
  111.  
  112. Cmd_ListA  DFB    $03                     ;All control calls are 3 parms long
  113.            DFB    $01                     ;Unit #1
  114.            DW     Ctrl_ListA              ;This has the interleave address
  115.            DFB    $06                     ;Set_Down_Adr control code
  116.  
  117. Ctrl_ListA DW    $02                      ;Two bytes for download address
  118.            DW    $0062                    ;Interleave address
  119.  
  120. Cmd_ListB  DFB    $03                     ;All control calls are 3 parms long
  121.            DFB    $01                     ;Unit #1
  122.            DW     Ctrl_ListB              ;This has the interleave value
  123.            DFB    $07                     ;Download control code
  124.  
  125. Ctrl_ListB DW     $01                     ;Two bytes for download address
  126.            DFB    $02                     ;Mac Disk Interleave value
  127.  
  128. Cmd_ListC  DFB    $03                     ;All control calls are 3 parms long
  129.            DFB    $01                     ;Unit #1
  130.            DW     Ctrl_ListC              ;This has the sides byte address
  131.            DFB    $06                     ;Set_Down_Adr control code
  132.  
  133. Ctrl_ListC DW    $02                      ;Two bytes for download address
  134.            DW    $0062                    ;Interleave address
  135.  
  136. Cmd_ListD  DFB    $03                     ;All control calls are 3 parms long
  137.            DFB    $01                     ;Unit #1
  138.            DW     Ctrl_ListD              ;This has the sides value
  139.            DFB    $07                     ;Download control code
  140.  
  141. Ctrl_ListD DW     $01                     ;Two bytes for download address
  142.            DFB    $00                     ;Value for single sided disk
  143.  
  144. Ctrl_ListE DFB    $01                     ;Format call has just one parameter
  145.            DFB    $01                     ;Unit number
  146.  
  147. Note:    You may encounter difficulties when switching 400K single-
  148. sided disks and 800K double-sided disks in the same drive.  STATUS 
  149. requests for the number of blocks on the disk in the drive are 
  150. valid for the disk last accessed.  Thus, when you READ from an 
  151. 800K disk, eject it, and insert a 400K disk, a STATUS call will 
  152. reveal a size of 800K until a READ or WRITE command is issued.  
  153. Applications which intend to handle both 800K and 400K disks 
  154. should do a READ before each STATUS call.
  155.  
  156.  
  157. Further Reference
  158. o    Apple IIGS Firmware Reference
  159. o    Apple IIc Technical Reference Manual
  160.  
  161.